package com.hnevc.caoliuye;

import java.util.Scanner;

public class Homework {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int a = sc.nextInt();
        sc.close();
        String str = "*";
        for (int i = 0; i < a; i++) {
            for (int j = 0; j < a; j++) {
                if (i == 0) {
                    System.out.print(str);
                } else if (i == a - 1) {
                    System.out.print(str);
                } else if (j == 0 || j == a - 1) {
                    System.out.print(str);
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
